home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / devel / tcl / itcl1_31.z / itcl1_31 / tcldev / itcl-1.3 / tests / AAA.test next >
Encoding:
Text File  |  1993-10-15  |  1.9 KB  |  79 lines

  1. #
  2. # AAA - first test executed in test suite
  3. # ----------------------------------------------------------------------
  4. #   AUTHOR:  Michael J. McLennan       Phone: (215)770-2842
  5. #            AT&T Bell Laboratories   E-mail: aluxpo!mmc@att.com
  6. #
  7. #     SCCS:  @(#)AAA.test    1.2 (10/14/93)
  8. # ----------------------------------------------------------------------
  9. #            Copyright (c) 1993  AT&T  All Rights Reserved
  10. # ======================================================================
  11.  
  12. # ----------------------------------------------------------------------
  13. #  SHOULD HAVE A CLEAN SLATE
  14. # ----------------------------------------------------------------------
  15. test {No object info (no classes)} {
  16.     itcl_info classes
  17. } {
  18.     $result == ""
  19. }
  20.  
  21. test {No object info (no objects)} {
  22.     itcl_info objects
  23. } {
  24.     $result == ""
  25. }
  26.  
  27. # ----------------------------------------------------------------------
  28. #  TEST CLASS AUTO-LOADING
  29. # ----------------------------------------------------------------------
  30. test {Force auto-loading through inheritance} {
  31.     FooBar x
  32. } {
  33.     $result == "x"
  34. }
  35.  
  36. test {Info: all classes} {
  37.     itcl_info classes
  38. } {
  39.     [test_cmp_lists $result {Foo Bar FooBar}]
  40. }
  41.  
  42. test {Info: all classes matching a pattern} {
  43.     itcl_info classes *oo*
  44. } {
  45.     [test_cmp_lists $result {Foo FooBar}]
  46. }
  47.  
  48. # ----------------------------------------------------------------------
  49. #  OBJECT AUTO-NUMBERING
  50. # ----------------------------------------------------------------------
  51. test {Create object with auto-naming} {
  52.     FooBar #auto -blit x
  53. } {
  54.     $result == "FooBar0" && [FooBar0 info public blit -value] == "x"
  55. }
  56.  
  57. test {Create object with auto-naming} {
  58.     FooBar #auto -blit y
  59. } {
  60.     $result == "FooBar1" && [FooBar1 info public blit -value] == "y"
  61. }
  62.  
  63. test {Auto-naming should avoid names already in use} {
  64.     FooBar FooBar2
  65.     FooBar FooBar3
  66.     FooBar FooBar4
  67.     FooBar #auto
  68. } {
  69.     $result == "FooBar5"
  70. }
  71.  
  72. test {Destroy all outstanding objects} {
  73.     foreach obj [itcl_info objects] {
  74.         $obj delete
  75.     }
  76. } {
  77.     $result == ""
  78. }
  79.